<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrom=1">
	<meta http-equiv="Cache-Control" content="no-store"/>
	<meta http-equiv="Pragma" content="no-cache"/>
	<meta http-equiv="Expires" content="0"/>
 	<%@ include file="../base.jsp" %>
	<title>人员列表</title>
	<script type="text/javascript">
	 function doReturn(url){
			if(confirm("删除后不可恢复！")){
				//如果是true，页面返回index页面
				location.href=url;
			}else{
				//如果是false，页面不做处理
			}
		}
	
	</script>
</head>
<body>
  <div class="con_wrap">
  	<%@ include file="../head.jsp" %>
     <div id="main">
		<form id="queryForm" action="${ctx}/home/userList.do" name="queryForm" method="get" style="display: inline;">
			<div id="main">
				<dl class="section_wrap">
					<dt><h2>搜索</h2></dt>
					<dd class="dd">
						<table class="form">
							<tr>
								<td class="tit">姓　名：</td>		
								<td>
									<input value="${page.name}" id="name" name="name" maxlength="64"  class="w20"/>
								</td>
								　
								<td class="tit">性　别：</td>		
								<td>				 
									<div class="btn-group" data-toggle="buttons" style="width:200px;height:25px;">
										 <label style="height:25px;line-height: 13px;"
											class="btn btn-primary <c:if test="${page.sex==0}"> active </c:if> ">
											<input type="radio" id="sex" name="sex" value="0" autocomplete="off"
											<c:if test="${page.sex==0}"> checked </c:if>>
											不限
										</label><label style="height:25px;line-height: 13px;"
											class="btn btn-primary <c:if test="${page.sex==1}"> active </c:if> ">
											<input type="radio" id="sex" name="sex" value="1" autocomplete="off"
											<c:if test="${page.sex==1}"> checked </c:if>>
											男
										</label> <label style="height:25px;line-height: 13px;"
											class="btn btn-primary <c:if test="${page.sex==2}"> active </c:if> ">
											<input type="radio" id="sex" name="sex" value="2" autocomplete="off"
											<c:if test="${page.sex==2}"> checked </c:if>>
											女
										</label>
									</div>
								</td>
							</tr>
							<tr>
								<td class="tit"><span style="color: red"> * </span>角　色：</td>
								<td class="SELECT">
									<select  id="role" name="role" class="chzn-select-deselect w20" data-placeholder="Choose a role...">
											<option value=""></option>
											<c:forEach items="${roleList }" var="role">
												<option value="${role.id}" <c:if test="${role.id==page.role}"> selected </c:if>  >${role.role}</option>
											</c:forEach>
									</select>
								</td>
								<td class="tit">　　</td>
								<td>
									<input name="Input" class="button blue" value="搜索" onclick="getReferenceForm(this).action='${ctx}/home/userList.do'" type="submit"/>
								</td>
							</tr>
						</table>
					</dd>
				</dl>
	
	
				<dl class="section_wrap">
					<dt><h2>人员列表</h2></dt>
					<dd class="dd">
						<table class="grid">
							<thead>
							  <tr>
								<th style="text-align:center;" >id</th>
								<th style="text-align:center;" >姓　名</th>
								<th style="text-align:center;" >身份证</th>
								<th style="text-align:center;" >性　别</th>
								<th style="text-align:center;" >类　型</th>
								<th style="text-align:center;">积　分</th>
								<th style="text-align:center;">ｏｐ</th>
							  </tr>
						  </thead>
						  <tbody>
						   <c:forEach items="${page.result}" var="user" varStatus="status">
							  <tr class="${status.count % 2 == 0 ? 'odd' : 'even'}" style="text-align:center;"  >
								<td>${user.id}</td>
								<td>${user.name}</td>
								<td>${user.cardId}</td>
								<td> 
								<c:choose>
										<c:when test="${user.sex==1}">男</c:when>
										<c:otherwise>女</c:otherwise>
								</c:choose>
								
								</td>
								<td> 
									<c:forEach items="${roleList}" var="role">
	     								 <c:if test="${role.id==user.role}">
												${role.role}
	     								</c:if> 
	     							</c:forEach>
								</td>
								<td>${user.point}</td>
								<td>
								<c:if test="${((sessionScope.sessionUeser.id!=user.id && sessionScope.sessionUeser.role==3)||(user.role==1))}">
									<a href="javascript:doReturn('${ctx}/home/delete.do?id=${user.id}')">
										<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
									</a>&nbsp;&nbsp;&nbsp;
									<a href="${ctx}/home/show.do?id=${user.id}">
										<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
									</a>&nbsp;&nbsp;&nbsp;
									<a href="${ctx}/home/toUpdate.do?id=${user.id}">
										<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
									</a>
								</c:if>
								</td>
							 </tr>
			  	  			</c:forEach>
						  </tbody>
						</table>
						<!--  -->
						<%@ include file="../pagebar.jsp" %>
						<input type="hidden" id="url" value="${page.url}/userList.do">
					</dd>
				</dl>
			</div>
		</form>
	</div>
	<div id="footer">
		<%@ include file="../footer.jsp" %>
	</div>
</div>
</body>
</html>	